{include file="public/header" /}

<div class="layui-card">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
            </ul>

            <div class="layui-tab-content" >
                <div class="layui-tab-item layui-show">
                    <form class="layui-form layui-form-pane" action="/admin/system/config_add" method="post" id="add">
                        <input type="text" name="id" value="{$v.id}">
                        <input type="text" name="uid" value="{$v.uid}">
                        <div class="layui-form-item">
                            <label class="layui-form-label">参数标题</label>
                            <div class="layui-input-inline">
                                <input type="text" name="varinfo" value="{$v.varinfo}" required lay-verify="required" placeholder="请输入参数标题" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">参数值</label>
                            <div class="layui-input-inline">
                                <input type="text" name="varvalue" value="{$v.varvalue}" required lay-verify="required" placeholder="请输入参数值" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">字段名(英文)</label>
                            <div class="layui-input-inline">
                                <input type="text" name="varname" value="{$v.varname}" required lay-verify="required" placeholder="请输入字段名(英文) 必须以sys_开头" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>字段类型
                            </label>
                            <div class="layui-input-block">
                                <input type="radio" name="vartype" value="0" title="单行文字" {if condition="$v['vartype'] eq 0"} checked {/if}>
                                <div class="layui-unselect layui-form-radio layui-form-radioed">
                                    <i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                    <div>单行文字</div>
                                </div>
                                <input type="radio" name="vartype" value="1" title="多行文字" {if condition="$v['vartype'] eq 1"} checked {/if}>
                                <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                    <div>多行文字</div>
                                </div>
                                <input type="radio" name="vartype" value="2" title="图片" {if condition="$v['vartype'] eq 2"} checked {/if}>
                                <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                    <div>图片</div>
                                </div>
                                <input type="radio" name="vartype" value="3" title="下拉框" {if condition="$v['vartype'] eq 3"} checked {/if}>
                                <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                    <div>下拉框</div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>排序
                            </label>
                            <div class="layui-input-block">
                                <input type="text" name="disorder" autocomplete="off" value="{$v.disorder}" placeholder="排序值只能为数字"
                                       class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>状态
                            </label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" value="1" title="显示" {if condition="$v['status'] eq 1"} checked {/if}>
                                <div class="layui-unselect layui-form-radio layui-form-radioed">
                                    <i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                    <div>显示</div>
                                </div>
                                <input type="radio" name="status" value="0" title="隐藏" {if condition="$v['status'] eq 0"} checked {/if}>
                                <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                    <div>隐藏</div>
                                </div>
                            </div>
                        </div>





                        <script type="text/javascript" src="/static/admin/lib/layui/layui.js"></script>
                        <script type="text/javascript" src="/static/admin/js/mylayui.js?v=v1.3.5"></script>






                    <div class="layui-form-item">
                        <button class="layui-btn" type="submit" lay-filter="add" lay-submit="">
                            保存
                        </button>
                    </div>
                    <div style="height:100px;"></div>
                </div>



            </div>

        </div>
</div>

<script>
    layui.use(['element','layer','form','upload'], function(){
        var  $ = layui.jquery;//jquery
        var lement = layui.element;//面包导航
        var layer = layui.layer;//弹出层
        var form = layui.form;
        var upload = layui.upload;





        //监听提交
        form.on('submit(add)', function(data){
            var title=$("input[name='title']").val();
            //var content=$("textarea[name='content']").val();

            var article_category_id=$('#article_category_id option:selected') .val();//所属文章类型
            //alert(title);
            //var form=$("#cate_add").serialize();
            if(title==""){
                layer.msg('文章标题不能为空',{icon:5,time:2000});return false;
            }
            if(article_category_id==""){
                layer.msg('文章类型不能为空',{icon:5,time:2000});return false;
            }
            /*if(content){
                layer.msg("文章内容不能为空！",{icon:5,time:2000});return false;
          }*/
            var data = data.field;
            $.ajax({
                type:"post",
                url:"",
                data:data,
                dataType:"json",
                success:function(data){
                    if(data.status==1){
                        layer.msg(data.info, {icon: 6,time:2000},function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                        return false;

                    }else{
                        layer.msg(data.info,{icon:5,time:2000});return false;
                    }
                }

            });

        });

    })
</script>


    <script>
        layui.use(['laydate','form'], function(){
            var laydate = layui.laydate;
            var  form = layui.form;

        });

    </script>
    </body>
    </html>